package com.swanclouds.redfish.managers;

import com.google.common.base.Preconditions;
import com.swanclouds.api.managers.SnmpService;
import com.swanclouds.core.transport.ClientConstants;
import com.swanclouds.model.common.ActionResponse;
import com.swanclouds.redfish.internal.BaseManagerService;
import com.swanclouds.redfish.managers.domain.SnmpServiceModel;

public class SnmpServiceImpl extends BaseManagerService implements SnmpService {

    /**
     * 查询SNMP服务信息
     * @return SnmpServiceModel
     */
    @Override
    public SnmpServiceModel get() {
        return get(SnmpServiceModel.class,uri(ClientConstants.PATH_MANAGERS_SNMPSERVICE,getManagerId())).execute();
    }

    /**
     * 修改服务器SNMP服务信息
     * @return  com.swanclouds.redfish.managers.domain.SnmpServiceModel
     **/
    @Override
    public SnmpServiceModel update() {
        return patch(SnmpServiceModel.class, uri(ClientConstants.PATH_MANAGERS_SNMPSERVICE))/*.entity()*/.execute();
    }

    /**
     * 发送SNMP 测试事件
     * @return  com.swanclouds.model.common.ActionResponse
     **/
    @Override
    public ActionResponse sendTestEvent(SnmpServiceModel snmpServiceModel) {
        Preconditions.checkNotNull(snmpServiceModel.getMemberId(),"memberId is null");
        return post(ActionResponse.class,uri(ClientConstants.PATH_MANAGERS_SNMPSERVICE_SUBMITTESTEVENT,getManagerId())).entity(snmpServiceModel).execute();
        }
}
